using System.Collections.Generic;
using UnityEngine;

public class FormManager : MonoBehaviour {

    public static FormManager Current { get; set; }

    [SerializeField]
    List<Form> forms = new List<Form>();

    void OnEnable() {
        Current = this;
    }

    public GameObject SpawnForm(string form) {
        return Instantiate(GetForm(form).prefab);
    }

    public Form GetForm(string form) {
        return forms.Find(s => s.name == form);
    }

    [System.Serializable]
    public struct Form {
        public string name;
        public GameObject prefab;
        public Sprite icon;

        public Form(string name, GameObject prefab) {
            this.name = name;
            this.prefab = prefab;
            icon = null;
        }
    }
}